<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>vue组件</title>
</head>

<body>
  <div id="app">
    <child-comp1></child-comp1>
    <ul>
      <li>111</li>
      <li>111</li>
      <li>111</li>
      <li>111</li>
      <li>111</li>
    </ul>
    <child-comp1></child-comp1>
    <child-comp2></child-comp2>
  </div>


  <div id="app2">
    <child-comp1></child-comp1>
    <child-comp2></child-comp2>

  </div>

  <script src="https://cdn.jsdelivr.net/npm/vue@2.7.8/dist/vue.js"></script>
  <script>
    // 全局组件：任何一个vue实例当中都可以使用
    Vue.component('ChildComp1', {
      template: `<h2>A Child Component11111!</h2>`
    })
    // 局部组件：只能在注册它的vue实例中使用
    const app = new Vue({
      el: '#app',
      components: {
        ChildComp2: {
          template: `<h2>A Child Component222222!</h2>`,
        }
      },
      data: {

      },
      methods: {

      }
    });


    const app2 = new Vue({
      el: '#app2',
      data: {

      },
      methods: {

      }
    })
  </script>
</body>

</html>